/*
 * DataBaseWindow.h
 *
 *  Created on: 25.03.2009
 *      Author: Konan Andrej
 */

#ifndef DATABASEWINDOW_H_
#define DATABASEWINDOW_H_

#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QPushButton>
#include <QSpacerItem>
#include <QTableView>
#include <QComboBox>
#include <QString>
#include <QDialog>
#include <QLabel>
#include <QRect>

#include "StockItemDialog.h"
#include "StockTableView.h"
#include "ItemEditDlg.h"
#include "StockModel.h"
#include "ItemType.h"
#include "Debug.h"

class DataBaseWindow : public QDialog
{
	Q_OBJECT
private:
	StockTableView* DBTable;

	QPushButton* AddButton;
	QPushButton* EditButton;
	QPushButton* RemoveButton;
        QPushButton* CloseButton;

	QVBoxLayout* ActionButtonsLayout;
	QHBoxLayout* TableAndButtonsLayout;
	QVBoxLayout* DBDialogLayout;

        ItemEditDlg* ItemDlg;

	int LastPressed;
	//0 - NOTHING, 1 - ADD, 2 - EDIT

	DataBase* DB;

private slots:
        int AddItem( const ItemType& item );
        int EditItem( const ItemType& item );

	void AddPressed();
        void EditPressed();
        void RemovePressed();

        void GetItem( const ItemType& item );


public:
	DataBaseWindow( DataBase* db, QWidget *parent = 0 );
};

#endif /* DATABASEWINDOW_H_ */
